package com.dyw.springboot03.controller;

import com.dyw.springboot03.entity.User;
import com.sun.source.tree.ReturnTree;
import org.springframework.web.bind.annotation.*;

import java.sql.SQLOutput;

/**
 * Devil
 *
 * @author Devil
 * @create 2022-01-20-13:58
 */
@RestController
@RequestMapping("/users")
public class MyController {
    @PostMapping
    public String save(){
        System.out.println("user save...");
        return "{'module':user save}";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("user delete..."+id);
        return "{'module':user delete}";
    }
    @PutMapping
    public String update(@RequestBody User user){
        System.out.println("user update..."+user);
        return "{'module':user update}";
    }
    @GetMapping("/{id}")
    public String getById(Integer id){
        System.out.println("user getById..."+id);
        return "{'module':user getById}";
    }
    @GetMapping
    public String getAll(){
        System.out.println("user getAll...");
        return "{'module':user getAll}";
    }
}
